cmake_minimum_required(VERSION 3.8)
project(fishbot_sensor_monitor)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# 1. 查找依赖包
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(image_transport REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(OpenCV REQUIRED)

# 2. 配置头文件路径（让编译器找到include目录下的头文件）
include_directories(
  include
)

# 3. 编译C++节点（源文件+头文件）
add_executable(sensor_monitor_node
  src/sensor_monitor_node.cpp
)

# 4. 链接依赖库
ament_target_dependencies(sensor_monitor_node
  rclcpp
  sensor_msgs
  image_transport
  cv_bridge
  OpenCV
)

# 5. 安装可执行文件（让ROS 2能找到节点）
install(TARGETS
  sensor_monitor_node
  DESTINATION lib/${PROJECT_NAME}
)

# 6. 安装头文件（后续其他包引用时需要）
install(DIRECTORY
  include/
  DESTINATION include
)

ament_package()